$(function () {
    $('#submit').click(function (event) {
        // 阻止默认点击提交表单事件
        event.preventDefault();
        var old_pwd = $('input[name=old_pwd]').val();
        var new_pwd1 = $('input[name=new_pwd1]').val();
        var new_pwd2 = $('input[name=new_pwd2]').val();
        juneajax.post({
            'url': '/cms/resetpwd/',
            'data': {
                'old_pwd': old_pwd,
                'new_pwd1': new_pwd1,
                'new_pwd2': new_pwd2
            },
            'success': function (data) {
                if (data['code'] === 200) {
                    junealert.alertSuccessToast('恭喜，密码修改成功！');
                    window.location.reload()
                }else{
                    junealert.alertInfo(data['message']);
                    window.location.reload()
                }
            },
            'fail': function (error) {
                junealert.alertErrorToast('网络错误');
                window.location.reload()
            }
        })
    })
});